package com.example.mimageview;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // 根据id获得ImageView对象
        ImageView logo = (ImageView) findViewById(R.id.imageView1);
        // 设置logo对象的图片资源
        logo.setImageResource(R.mipmap.android_logo);
        button01 = (Button) findViewById(R.id.button1);
        button01.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // 弹出对话框
                new AlertDialog.Builder(MainActivity.this).setTitle("ADT")
                        .setMessage("欢迎来到Android开发世界")
                        .setPositiveButton("确定", null).show();
            }
        });
    }

    private Button button01;
}
